package com.mindai.esper.monitor.biz.epl;

import com.espertech.esper.client.*;
import com.mindai.esper.monitor.biz.domain.model.EsperAlarmEplModel;
import com.mindai.esper.monitor.biz.domain.model.EsperDbModel;
import com.mindai.esper.monitor.biz.domain.model.EsperMethodModel;
import com.mindai.esper.monitor.biz.domain.model.EsperSchemaModel;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;

/**
 * Created by Ladd on 16-6-30.
 */
public class AlarmEPLManager implements Serializable {

    private EPAdministrator admin = null;
    private Map<Integer, EsperSchemaModel> allSchema = null;
    private Map<Integer, EsperAlarmEplModel> allEpls = null;
    private Map<String, EsperMethodModel> allMethods = null;
    private Map<String, EsperDbModel> allDbs = null;
    private EPRuntime runtime = null;
    private EPServiceProvider epService = null;
    private Map<Integer, EPStatement> schemaStateMap = new HashMap<Integer, EPStatement>();
    private Map<Integer, EPStatement> eplStateMap = new HashMap<Integer, EPStatement>();
    private Map conf = null;
    private Configuration configuration = null;
    private CountDownLatch latch;
    private boolean isUpdate = false;

    public AlarmEPLManager(Map conf, CountDownLatch latch) {
//
//        this.conf = conf;
//        this.latch = latch;
//        //1 创建一个 Configuration 配置
//        this.configuration = new Configuration();
//        this.addMethods(configuration);
//        this.addEsperDb();
//
//        //2、通过 EPServiceProviderManager通过参数configuration,获得EPServiceProvider(引擎实例epService);
//        this.epService = EPServiceProviderManager.getDefaultProvider(configuration);
//        //3、通过 EPServiceProvider 获得 EPAdministrator 对象;
//        this.admin = epService.getEPAdministrator();
//        //4、通过 EPAdministrator 和 EPL 查询语句，创建 EPStatement
//        this.addSchemas();//admin 创建epl
//
//        this.addEsperEpl();
//        this.start();
    }


}
